Skip to content

Comments

[countersyncd]: Add communication statistics recording and utilities#4151

Merged
prsunny merged 3 commits intosonic-net:masterfrom
Pterosaur:countersyncd_add_debug
Jan 24, 2026
Merged

[countersyncd]: Add communication statistics recording and utilities#4151
prsunny merged 3 commits intosonic-net:masterfrom
Pterosaur:countersyncd_add_debug

Conversation

@Pterosaur
Copy link
Contributor

@Pterosaur Pterosaur commented Jan 23, 2026

What I did
Add more debug and statistics logs for countersyncd

Why I did it
Used for analyzing online issues and performance.

How I verified it
Locally check

[2026-01-23 06:24:54.637] [crates/countersyncd/src/utilities/mod.rs:140] [INFO] Comm stats [data_netlink->ipfix_records]: count=1, avg_len=0.00, peak_len=0, min_len=0, last_len=0, rms_len=0.00, nonzero_count=0, capacity=1024, avg_util=0.00, peak_util=0.00
[2026-01-23 06:24:54.642] [crates/countersyncd/src/utilities/mod.rs:140] [INFO] Comm stats [ipfix->stats_reporter]: count=2339, avg_len=791.59, peak_len=1024, min_len=0, last_len=187, rms_len=853.35, nonzero_count=2338, capacity=1024, avg_util=0.77, peak_util=1.00

Details if related

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Pterosaur Pterosaur marked this pull request as ready for review January 23, 2026 06:30
@Pterosaur Pterosaur requested a review from prsunny as a code owner January 23, 2026 06:30
Copilot AI review requested due to automatic review settings January 23, 2026 06:30
@Pterosaur Pterosaur force-pushed the countersyncd_add_debug branch from 9b268e0 to 9ffb842 Compare January 23, 2026 06:31
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Pterosaur Pterosaur force-pushed the countersyncd_add_debug branch from 9ffb842 to 13a10a8 Compare January 23, 2026 06:33
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds communication statistics recording and debugging utilities to countersyncd for analyzing online issues and performance. The changes introduce a new utilities module with functions for formatting hex dumps and tracking inter-actor channel statistics.

Changes:

  • Added utilities module with hex formatting and channel statistics tracking
  • Instrumented all actor message receive points to record queue lengths
  • Added debug logging for raw netlink message payloads

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/countersyncd/src/utilities/mod.rs New module providing hex formatting utility and communication statistics tracking with periodic logging
crates/countersyncd/src/main.rs Added utilities module and initialized channel capacity tracking for all communication channels
crates/countersyncd/src/lib.rs Exported the new utilities module
crates/countersyncd/src/actor/stats_reporter.rs Added channel statistics recording for IpfixToStatsReporter channel
crates/countersyncd/src/actor/otel.rs Added channel statistics recording for IpfixToOtel channel and cleaned up trailing whitespace
crates/countersyncd/src/actor/ipfix.rs Added channel statistics recording for SwssToIpfixTemplates and DataNetlinkToIpfixRecords channels, cleaned up whitespace
crates/countersyncd/src/actor/data_netlink.rs Added channel statistics recording for ControlNetlinkToDataNetlink channel and hex dump logging for netlink messages, cleaned up whitespace
crates/countersyncd/src/actor/counter_db.rs Added channel statistics recording for IpfixToCounterDb channel

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

impl ChannelLabel {
fn as_str(self) -> &'static str {
match self {
ChannelLabel::ControlNetlinkToDataNetlink => "control_netlink->data_netlink_cmd",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to use . instead of ->

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link

@r12f r12f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 minor comment. overall looking good.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to msft-202412: Azure/sonic-swss.msft#199

@mssonicbld
Copy link
Collaborator

@Pterosaur cherry pick PR didn't pass PR checker. Please check!!!
Azure/sonic-swss.msft#199

1 similar comment
@mssonicbld
Copy link
Collaborator

@Pterosaur cherry pick PR didn't pass PR checker. Please check!!!
Azure/sonic-swss.msft#199

@vmittal-msft
Copy link
Contributor

@Pterosaur @liat-grozovik please manually create 202511 as there are cherry pick conflicts.

@Pterosaur
Copy link
Contributor Author

Retrigger msbuild bot

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202511: #4222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants